package com.example.controller;

import com.example.domain.R;
import com.example.domain.User;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.UnsatisfiedServletRequestParameterException;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;


@RestController
@Validated
public class TestAction {

    @RequestMapping("/testException")
    public R testException(@NotNull(message = "code不能为空") String code){
        System.out.println(code);
        return R.success("成功");
    }
    @RequestMapping("/testUser")
    public R testUser(@Valid User user){
        System.out.println(user.getUserName()+"--"+user.getPassword());
        return R.success();
    }
}
